package com.zy.drug.converters;

import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.alibaba.excel.converters.bigdecimal.BigDecimalNumberConverter;
import java.math.BigDecimal;

/**
 * author hxl
 */
public class BigDecimalConverter extends BigDecimalNumberConverter {


    /**
     * 这里读的时候会调用
     * param cellData
     * param contentProperty
     * param globalConfiguration
     * return
     */
    public BigDecimal convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty,
                                        GlobalConfiguration globalConfiguration) {
        if(cellData.getNumberValue() != null){
            return BigDecimal.valueOf(cellData.getNumberValue().doubleValue());
        }
       return BigDecimal.ZERO;
    }
}